<!--
    -  Copyright (c) 2018-2025, haohanwork.com All rights reserved.
  -->
<template>
    <div class="execution">
        <basic-container>
            <avue-crud ref="crud"
                       :page.sync="page"
                       :data="tableData"
                       :table-loading="tableLoading"
                       :option="tableOption"
                       @on-load="getList"
                       @search-change="searchChange"
                       @refresh-change="refreshChange">
            </avue-crud>
        </basic-container>
    </div>
</template>

<script>
    import {fetchList,} from '@/api/crm/customerupdatelog'
    import {tableOption} from '../../const/crud/crm/customerupdatelog'

    export default {
        name: 'customerupdatelog',
        data() {
            return {
                tableData: [],
                page: {
                    total: 0, // 总页数
                    currentPage: 1, // 当前页数
                    pageSize: 20 // 每页显示多少条
                },
                tableLoading: false,
                tableOption: tableOption
            }
        },
        methods: {
            getList(page, params = {}) {
                this.tableLoading = true;
                // 操作时间段处理
                if (params.opTimeRange && params.opTimeRange.length === 2) {
                    params.startDate = params.opTimeRange[0];
                    params.endDate = params.opTimeRange[1];
                }
                delete params.opTimeRange;
                fetchList(Object.assign({
                    current: page.currentPage,
                    size: page.pageSize
                }, params)).then(response => {
                    this.tableData = response.data.data.records
                    this.page.total = response.data.data.total
                    this.tableLoading = false
                })
            },
            /**
             * 搜索回调
             */
            searchChange(form, done) {
                this.getList(this.page, form);
                done();
            },
            /**
             * 刷新回调
             */
            refreshChange(info) {
                this.getList(this.page, this.filterForm(info.searchForm));
            }
        }
    }
</script>

<style lang="scss" scoped>
</style>
